#ifndef NYU_VALUE_H_
#define NYU_VALUE_H_

#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif

typedef intptr_t NyuValue;

#define NYU_VALUE_IS_INT(X) (!((X) & 1))
#define NYU_VALUE_IS_OBJECT(X) (((X) & 3) == 1)
#define NYU_VALUE_IS_BLOCK(X) (((X) & 3) == 3)

#define NYU_VALUE_TO_INT(X) ((X) >> 1)
#define NYU_VALUE_FROM_INT(X) ((X) << 1)

#define NYU_VALUE_TO_OBJECT(X) ((X) ^ 1)
#define NYU_VALUE_FROM_OBJECT(X) ((X) | 1)

#define NYU_VALUE_TO_BLOCK(X) ((X) ^ 3)
#define NYU_VALUE_FROM_BLOCK(X) ((X) | 3)

#endif /* NYU_VALUE_H_ */
